	function clsClubAdminLetterWrite_Info(){
		this._HTMLDom = null;	
		this.listData = null;
		this.idx = null;
		this._init();
	}
	
	clsClubAdminLetterWrite_Info.prototype = {
		_init: function(){
			var $layer = $("section#club_admin_letter_write");
			this._HTMLDom = {
				"$layer": $layer
				, "$select": $layer.find("div.input_cont select")
				, "$input": $layer.find("li.input_letter textarea")
			}
			var $options = [{
				"코드": "0"
				, "코드명": "회원전체"
			}
			, {
				"코드": "A"
				, "코드명": "일반회원"
			}
			, {
				"코드": "M"
				, "코드명": "매니저"
			}];	
			this.setList($options);	
		}
		, setList: function(thisData){
			this.listData = thisData;
			this.display();
		}
		, display: function(){
			var $select = this._HTMLDom["$select"];
			var thisClass = this;
			
			$select.empty();
			
			for(var i=0;i<this.listData.length;++i){
				$select.append("<option />");	
			}
			
			$select.find("option").each(function(n){
				$(this).html(thisClass.listData[n]["코드명"]);
			});
			
			$select.selectmenu("refresh");
		}
		, getSelectValue: function(){
			var $select = this._HTMLDom["$select"];
			var idx = $select.find("option").index($select.find(":checked"));
			
			return this.listData[idx]["코드"];
		}
		, getTextValue: function(){
			var $input = this._HTMLDom["$input"];
			
			return $input.val();
		}
		, $getLayer: function(){
			return this._HTMLDom["$layer"];
		}
	}
	
	function clsComm_ClubAdminLetterWrite(){
		this.writeRequest = null;
		this._init();
	}
	
	clsComm_ClubAdminLetterWrite.prototype = {
		_init: function(){
			this.writeRequest = {
				"대상회원": null
				, "메세지": null
			}
		}
		
		, insertMessage: function(arg){
			
			var thisClass = this;
			var objJson = new MJson();
			var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
			objJson.putPub(MJson.PUB.SID, "CL001");
			objJson.putPub(MJson.PUB.SERVICENAME, "sendClubMessage");
			
			objJson.putParameter("clubSeq", _gf.CLUB_DATA["동호회키"]);
			objJson.putParameter("targetMemberRole", this.writeRequest["대상회원"]);
			objJson.putParameter("messageBody", this.writeRequest["메세지"]);
			
			_util.ajaxLog(objJson.getJsonString());
			
			cm.requestGet(objJson.getJsonString(), function(ret){
				alert(ret["msp"]["contents"]["serviceResult"]);
				var resData = {
					"응답코드": (ret["msp"]["contents"]["serviceResult"]=="00000"?true:false)
					, "메세지": _util.getResultMsg(ret)
				}
				
				$(thisClass).trigger("evtFinishInsertSendMsg", resData);
			}, function($err) {
				alert($err);
			});
		}
		, setWriteRequest: function(key, val){
			this.writeRequest[key] = val;
		}
	}
	
	function ClubAdminLetterWrite(){
		this.club_seq = null;
		
		this.club_info = null;
		this.objClubAdminLetterWrite_Info = null;
		this.objComm = null;
	}
	
	ClubAdminLetterWrite.prototype = {
		onPageShow : function() {
			$("a").attr("href", "").attr("data-rel", "");
	    	
			this._init();
		}
		, _beforeStart: function(){
	    	var 	thisClass = this;
	    	
	    	this._permitStart = {
				"동호회정보": false	
			}
			
	  		// 서버 메시지맵
			$.ajax({
				url: "../js/src/club/club_inc.js"
				, type: "get"
				, dataType: "script"
				, async: false
				, success: function(ret, sta){
					//alert("success!!");					
				}
				, error:function(e){
					//alert("error=" + e);
				}	
			});
			
			_cb.getClubInfoData({
				"콜백": function(ret, l){
					thisClass._permitStart["동호회정보"] = true;	
				}
			});
			
			_util.executeThread(function(){
				for(key in thisClass._permitStart){		
					if(!thisClass._permitStart[key]) return false;
				}
				return (true);
			}, function(){			
				thisClass._start();
			});
	   }
		, _init: function(){
			this.objComm = new clsComm_ClubAdminLetterWrite();
			this.objClubAdminLetterWrite_Info = new clsClubAdminLetterWrite_Info();
			
			this._beforeStart();
			
			this.getParam();
	    	
			this._bind();	
		}
		, _start: function(){
			this.club_info = _cb.getClubInfo();
		}
		, _bind: function(){
			var thisClass = this;
			//등록완료 이벤트
			$(this.objComm).bind("evtFinishInsertSendMsg", function(event, resData){
				alert(resData["메세지"]);
				$.mobile.changePage("club_letter.html", "slide", true);
			});
			
			//보내기
			this.objClubAdminLetterWrite_Info.$getLayer().find("section div.btn_area02 div.ui-grid-a div a:eq(0)").click(function(event){
				thisClass.objComm.setWriteRequest("대상회원", thisClass.objClubAdminLetterWrite_Info.getSelectValue());
				thisClass.objComm.setWriteRequest("메세지", thisClass.objClubAdminLetterWrite_Info.getTextValue());
				thisClass.objComm.insertMessage();
			});
			
			//취소
			this.objClubAdminLetterWrite_Info.$getLayer().find("section div.btn_area02 div.ui-grid-a div a:eq(1)").click(function(event){
				event.preventDefault();
				_gf.CLUB_DATA = {
					"동호회키": thisClass.club_seq	
				}
				$.mobile.changePage("../inc/info_booking.html","slide",true);	
			});
			
			//엑스버튼
		 	$("section#club_admin_letter_write header div.top_title_G div.top_right a.btn11").click(function(event){
		 		event.preventDefault();
		 		_gf.CLUB_DATA = {
					"동호회키": thisClass.club_seq	
				}
		 		$.mobile.changePage("club_letter.html","slide",true);	
		 	});
			
			//메뉴
		 	$("section#club_admin_letter_write nav ul li a:eq(0)").click(function(event){
		 		event.preventDefault();
		 		thisClass.goNavi();
		 	});
		 	
		 	//알림
		 	$("section#club_admin_letter_write nav ul li:eq(1)").click(function(event){
		 		event.preventDefault();
		 		$.mobile.changePage("../inc/info_booking.html","slide",true);	
		 	});
		}
		, getParam: function(){
			this.club_seq = _gf.CLUB_DATA["동호회키"];
		}
		, _role: function(){
			if(!this.club_info.isMember()){
    			alert(this.club_info.getError());
    			_gf.CLUB_DATA = {
    				"동호회키": this.club_seq	
    			}
    			$.mobile.changePage("self_club.html","slide",true);
    			return;
    		}else if(!this.club_info.isAdmin()){
    			alert(this.club_info.getError());
    			_gf.CLUB_DATA = {
    				"동호회키": this.club_seq	
    			}
    			$.mobile.changePage("self_club.html","slide",true);
    			return;	
    		}
		}
		, goNavi: function(){			
			$.mobile.changePage("../inc/navi.html","slide",true);
		}
	  , spinStart: function(){		
			$.mobile.showPageLoadingMsg();			
		}
		, spinEnd: function(){			
			$.mobile.hidePageLoadingMsg();				
		}
	}